package com.example.tnot.Teacher.Homepart.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tnot.R;

import java.util.List;

public class VpSlideShowAdapter extends RecyclerView.Adapter<VpSlideShowAdapter.ViewHolder>{
    private Context context;
    private List<Integer> imageList;

    public VpSlideShowAdapter(Context context,List<Integer> imageList) {
        this.imageList = imageList;
        this.context = context;
    }

    @NonNull
    @Override
    public VpSlideShowAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_vp_image_slide, parent, false);
        return new VpSlideShowAdapter.ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull VpSlideShowAdapter.ViewHolder holder, int position) {
            holder.imageView.setImageResource(imageList.get(position));
    }

    @Override
    public int getItemCount() {
        return imageList.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder{
        ImageView imageView;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            imageView = itemView.findViewById(R.id.iv_slide_imageview);
        }
    }
}
